import type {
  AjaxPagingResult,
  EnterpriseMonthReportQueryAllListParams,
  EnterpriseMonthReportQueryAllListResult,
  EnterpriseMonthReportQueryListParams,
  EnterpriseMonthReportSaveOrUpdateElectricParams,
} from '@/types'

const controller = getAjaxBaseUrl(
  '/enterpriseMonthReport',
  '/energy',
)

/** 保存或更新电量核减情况表 */
export function saveOrUpdateElectric(params: EnterpriseMonthReportSaveOrUpdateElectricParams) {
  return post(`${controller}/saveOrUpdateElectricOffset`, params)
}

/** 查询电量核减情况表 */
export function queryListElectric(params: EnterpriseMonthReportQueryListParams) {
  return get(`${controller}/selectElectricOffset`, params)
}

/** 删除电量核减情况表 */
export function deleteElectricById(id: number) {
  return get(`${controller}/deleteElectricOffset`, { id })
}

/** 分页查询企业能耗报表预览信息 */
export function queryList(params: Partial<EnterpriseMonthReportQueryAllListParams> = {}) {
  return post<
    AjaxPagingResult<
      EnterpriseMonthReportQueryAllListResult[]
    >
  >(`${controller}/queryReportMessagePage`, params)
}
